package com.zynn.service.module.recommend.controller;


import com.zynn.common.pojo.result.Result;
import com.zynn.common.pojo.result.ResultUtil;
import com.zynn.service.module.recommend.entity.SchoolFriendWithWeight;
import com.zynn.service.module.recommend.service.RecommendService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author jerry-liqi
 * <p>
 * 推荐好友列表信息 API
 */
@RestController
@RequestMapping("/recommend")
public class RecommendController {


    @Autowired
    private RecommendService service;


    /**
     * @return List<SchoolFriendWithWeight>
     * @author jerry-liqi
     * <p>
     * 推荐同校好友
     */
    @RequestMapping("/recommend/schoolFriend")
    public List<SchoolFriendWithWeight> recommendSchoolFriends() {

        Long userId = 10231739L;

        return service.getRecommendSchoolFriends(userId);
    }


    @RequestMapping("/testCase")
    public String testFeign() {

        return "test feign case";
    }


    /**
     * 查询同校好友 智能推荐服务的数据埋点和服务架构
     */
    @RequestMapping("/sameSchool")
    public Result getSchoolInfo(@RequestParam(required = false) Long gradeId,
                                                        @RequestParam(required = false) Long departmentId,
                                                        @RequestParam(required =  false) Integer sex) {

        Long userId = 8329564L;

        Map<String,Object> map = new HashMap<>(16);
        map = service.recommendSchoolV2(userId,gradeId,departmentId,sex,1);

        return ResultUtil.success(map);
    }


}
